﻿
<!DOCTYPE html>
<html>
<head>
<title>hi hi 聊天室</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
<!-- Custom Theme files -->
<link href="/static/auth/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">
<link href="/static/auth/css/snow.css" rel="stylesheet" type="text/css" media="all" />
<link href="/static/auth/css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="shortcut icon" href="{{ url_for('static',filename='chat/images/hihi.jpg')}}">
<link rel="icon" href="{{ url_for('static',filename='chat/images/hihi.jpg')}}" type="image/x-icon">
<!-- //Custom Theme files -->

</head>
<body>
<div class="snow-container">
			  <div class="snow foreground"></div>
			  <div class="snow foreground layered"></div>
			  <div class="snow middleground"></div>
			  <div class="snow middleground layered"></div>
			  <div class="snow background"></div>
			  <div class="snow background layered"></div>
			</div>

<div class="top-buttons-agileinfo">
<!--<a href="index.html"  class="active">登录</a><a href="signup.html">注册</a>-->
</div>
<h1>欢迎来到 hi hi 聊天室</h1>
<div class="main-agileits">
<!--form-stars-here-->
		<div class="form-w3-agile">
			<h2 class="sub-agileits-w3layouts">登录系统</h2>
			<!--<form action="{{ url_for('main.login') }}" method="post">-->
			<form id="login" method="post">
					<input type="text" id="Username" placeholder="Username" required="" />
					<input type="password" id="Password" placeholder="Password" required="" />
					<a href="#" class="forgot-w3layouts">忘记密码 ?</a>
				<div class="submit-w3l">
                    <input type="button" value="登录" onclick="myLogin()" class="submit-button">
				</div>
				<p class="p-bottom-w3ls"><a href="{{ url_for('main.login') }}">这里注册</a>如果你还没有一个账号.</p>
			</form>
		</div>
		</div>
<!--//form-ends-here-->
<script type="text/javascript" src="/static/auth/js/jquery-2.1.4.min.js"></script>
<script>
	function myLogin(){
    var data = {};
    data['Username'] = $("#Username").val();
    data['Password'] = $("#Password").val();
    $.ajax(
        {
           type:'POST',
           url: '{{ url_for('main.login_check') }}',
           data: data,
           success:function (data) {
               if ( data == 'error' ){
                     alert("Invalid username or password.");
               }else if (data == 'success'){
                   window.location.href="{{ url_for('main.index') }}";
               }
           },
           error:function (xhr, type) {

           }
        }
    );
}
</script>
</body>
</html>
